<?php

	include "../controller/ConectBanco.php";

class SimCardDAO{

	function insert(SimCard $simcard){
	    									
		mysql_query("INSERT INTO simcard SET numero = '".$simcard->getNumero()."'
										   , numeroChip = '".$simcard->getNumeroChip()."'
										   , plano = '".$simcard->getPlano()."'
										   , vencimentoPlano = '".$simcard->getVencPlano()."'")	or die (mysql_error());	
		
		header("location:../view/ListaSimCards.php");
		
	}
	
	function delete($idSimCard){
		mysql_query("DELETE FROM simcard  WHERE idSimCard =".$idSimCard) or die (mysql_error());	
		
		header("location:../view/ListaSimCards.php");
	}
	
	function update(SimCard $simcard){
		mysql_query("UPDATE simcard SET  numero = '".$simcard->getNumero()."'
									   , numeroChip = '".$simcard->getNumeroChip()."'
									   , plano = '".$simcard->getPlano()."'
									   , vencimentoPlano = '".$simcard->getVencPlano()."'
							      WHERE idSimCard=".$simcard->getIdSimCard()) or die (mysql_error());	
		
		header("location:../view/ListaSimCards.php");
	}
}	
	
?>